<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>折纸问题</title>
    <script>
      /* 一张纸,厚度是0.01毫米,对折多少次可以超过地球和月球之间的距离384,400千米 */
      let paper = 0.00001
      let distance = 384400000
      let count = 0
      while (true) {
        paper *= 2
        count++
        if (paper > distance) {
          break
        }
      }
      alert('一共需要对折: ' + count + '次.')
    </script>
  </head>
  <body></body>
</html>
